package com.game.cards.spells;

import java.util.Scanner;

import com.game.cards.BaseCard;
import com.game.cards.MonsterCard;
import com.game.cards.SpellCard;
import com.game.play.Game;
import com.game.play.Player;

public class MonsterReborn extends SpellCard{
	
	public MonsterReborn(){
		this.title = "monster reborn".toUpperCase();
		this.description = "Target 1 monster in either player's Graveyard; Special"
				+ "\nSummon it.";
		
	}
	public void effect(Game game)
	{
		Scanner scan = new Scanner(System.in);
		Player current = game.getCurrentTurn();
		System.out.println("What monster would you like to bring back?");
		int count = 0;
		for (BaseCard c : current.getField().getGraveyard())
		{
			if (c instanceof MonsterCard)System.out.println("(" +count+")" + c.getTitle());
			count++;
		}
		if (current.getField().getGraveyard().size() >= 0) {MonsterCard c = (MonsterCard) current.getField().getGraveyard().get(scan.nextInt());
		current.getField().getGraveyard().remove(c);
		current.getField().specialSummon(c);
		System.out.println(c.getDescription() + " was brought back from the graveyard!");
		}
		//
		this.deck.getOwner().getField().removeSpellTrapById(this.id);
	}

}
